﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace MVCGalloSoftMV5.Models
{
    public class Actividad
    {
        [Key]
        public int ActividadId { get; set; }

        [Display(Name = "WBS")]
        [StringLength(50, MinimumLength = 1)]
        [Required(ErrorMessage = "El campo WBS es requerido")]
        public string Wbs { get; set; }
        
        [Display(Name="Descripción")]
        [StringLength(50, MinimumLength = 1)]
        [Required(ErrorMessage = "El campo Descripción es requerido")]
        public string Descripcion { get; set; }

        [Display(Name = "Costo")]
        [Column(TypeName = "money")]
        [Required(ErrorMessage = "El campo Costo Actividad es requerido")]
        public decimal Costo { get; set; }
        
        [Display(Name = "Porcentaje Ponderado")]
        public int? PorcentajePonderado { get; set; }
        
        [Display(Name = "Porcentaje Ganancia")]
        public int? PorcentajeGanancia { get; set; }

        [Display(Name = "Cantidad")]
        [Required(ErrorMessage = "El campo Cantidad Actividad es requerido")]
        public int Cantidad { get; set; }

        [Display(Name = "Unidad")]
        [Required(ErrorMessage = "El campo Unidad Actividad es requerido")]
        public int TipoUnidadId { get; set; }
        public virtual TipoUnidad TipoUnidad { get; set; }
        
        [Display(Name = "Fecha Inicio")]
        [DataType(DataType.Date)]
        public DateTime? FechaInicio {get; set;}
        
        [Display(Name = "Fecha Final")]
        [DataType(DataType.Date)]
        public DateTime? FechaFin { get; set; }

        [Display(Name = "Contratista")]
        [Column ("ContratistaId")]
        [Required(ErrorMessage = "El campo Contratista es requerido")]
        public int PersonaId { get; set; }
        public virtual Contratista Contratista { get; set; }

        public int? CoordenadaId { get; set; }
        public virtual Coordenada Coordenada { get; set; }

        [Display(Name = "Actividad Padre")]
        [Column("ActividadPadreId")] // valor por default 0 ??? 
        public int? ActividadPadreId { get; set; }
        
        public virtual ICollection<Pago> Pagos { get; set; }
        public virtual ICollection<DocumentoActividad> Documentos { get; set; }
        
    }

}
